package com.dagene.weixin.repository;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.dagene.weixin.entity.Newstable;

public interface NewtableDao extends PagingAndSortingRepository<Newstable, Integer> {

	Page<Newstable> findByType(short type, Pageable page);

	List<Newstable> findByType(short type);

	@Query("select a from Newstable a where title like CONCAT('%', ?1, '%')")
	List<Newstable> findByTitle(String title);

	@Query("select a from Newstable a where title like CONCAT('%', ?1, '%') and type = ?2")
	List<Newstable> findByTitleAndType(String title, short type);
}
